#ifndef OVERLAYEDITOR_H
#define OVERLAYEDITOR_H


#include "overlayDict.h"

class TExpressionDict;
class TOverlayDict;
class TOverlayTreeWidget;
class TElemCont;
class TElemContList;

///////////////////////////////////////////////////////////////////////////
// TOverlayEditor /////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//
class TOverlayEditor : public QDialog
{
	Q_OBJECT
public:
	TOverlayEditor( TExpressionDict *eDict, TOverlayDict *oDict, TElemContList &cList );

private slots:
	void slotFocusChanged( TOverlayTreeWidget *tr, bool state );
	//
	void slotCurrentModChanged( const QString &text );
	void slotCornerDataChanged();
	//
	void slotAddMod();
	void slotDelMod();
	void slotCloneMod();
	void slotAddExpression();
	void slotInsertEmptyString();
	void slotDelExpression();
	void slotPreview();
	void slotOk();
	void slotSave();

private:
	bool trySaveMod();
	void setDicts();
	void fillFields();
	void setChanged( bool changed );
	bool deleteEmptyStrings();
	//
	TOvrMod::EPos getactiveCornerPos();
	TOverlayTreeWidget* getCornerTree( TOvrMod::EPos pos );
	//
	TOvrMod::EPos activeCornerPos;
	bool changed;
	TExpressionDict *exprDict;
	TOverlayDict	*overlayDict;
	QStringList		mods;
	TOvrMod			curMod;
	TElemContList	&contList;
	//
	TOverlayTreeWidget	*ltTree
					,	*lbTree
					,	*rtTree
					,	*rbTree
					,	*active;
	QComboBox	*cmbMod;
	QPushButton *ok
			,	*save
			,	*cancel
			,	*bAddMod
			,	*bDelMod
			,	*bCloneMod
			,	*bAdd
			,	*bDel
			,	*bPreview;
	QAction		*actInsertExpr
			,	*actDeleteExpr
			,	*actInsertEmptyString;
};

#endif